package com.usian.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.usian.pojo.Consignee;

import com.usian.pojo.QueryPageBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;


@Mapper
@Repository
public interface ConsigneeDao extends BaseMapper<Consignee> {
    List<Consignee> findPage(QueryPageBean queryString);

    @Select("select t1.id,t1.phone,t1.name,t2.aid province,t2.bid city,t2.cid county from consignee t1,(select a.id aid,b.id bid,c.id cid from region a,region b,region c where a.id = b.pid and b.id = c.pid) t2 where t1.county_id = t2.cid and t1.id=#{value}")
    Consignee findById(Integer id);

    @Select("select id from region where name = #{value}")
    Integer findByName(String name);

    void deleteForEach(String[] ids);
}
